package com.power.ding.dao;

import com.power.ding.model.Di_rel_dept_correct;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 司法社矫组织机构表 持久层(hibernate)
 */

public interface Di_rel_dept_correctDao extends JpaRepository<Di_rel_dept_correct, Serializable>, JpaSpecificationExecutor<Di_rel_dept_correct>, Repository<Di_rel_dept_correct, Serializable>, Di_rel_dept_correctDaoCustom<Di_rel_dept_correct, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from Di_rel_dept_correct s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);

    @Query(value = "select * from v_rel_dept_law order by showorder",nativeQuery = true)
    List<Map<String,Object>> queryBaseOrg();

    @Query(value = "select * from v_rel_dept_lawuser",nativeQuery = true)
    List<Map<String,Object>> queryBaseOrgUser();


}
